﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;
using System.ComponentModel;
using Survey.ViewModels;

namespace Survey.Views
{
    /// <summary>
    /// The survey view contains no logic, it is only the design. The specified ViewModel handles what is displayed within the bindings.
    /// </summary>
    public partial class SurveyView : Window
    {
        private ISurveyViewModel _surveyViewModel;

        /// <summary>
        /// Default constructor
        /// </summary>
        public SurveyView()
        {
            InitializeComponent();

            //Remove the height if we aren't in the designer
            if (LicenseManager.UsageMode != LicenseUsageMode.Designtime)
            {
                this.Width = double.NaN; ;
                this.Height = double.NaN; ;
            }

            _surveyViewModel = new BasicViewModel();

            //Set DataContext to allow bindings to point at this ViewModel
            DataContext = _surveyViewModel;
        }

        private void VoteForOption(string option)
        {
            _surveyViewModel.VoteForOption(option);
        }
    }
}
